package com.zyh.server.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.TimeZone;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.zyh.server.utils.CustomDateTimeSerializer;
import lombok.Data;

/**
 * 
 * @TableName t_miaosha_goods
 */
@TableName(value ="t_miaosha_goods")
@Data
public class MiaoshaGoods implements Serializable {
    /**
     * 秒杀商品编号
     */
    @TableId(value = "miaosha_id", type = IdType.AUTO)
    private Integer miaoshaId;

    /**
     * 秒杀活动期间的商品价格
     */
    @TableField(value = "miaosha_price")
    private BigDecimal miaoshaPrice;

    /**
     * 秒杀活动期间商品的库存数量
     */
    @TableField(value = "miaosha_stock")
    private Integer miaoshaStock;

    /**
     * 秒杀活动的开始时间
     */
    @JsonSerialize(using = CustomDateTimeSerializer.class)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "Asia/Shanghai")
    @TableField(value = "start_time")
    private Date startTime;

    /**
     * 秒杀活动的结束时间
     */
    @JsonSerialize(using = CustomDateTimeSerializer.class)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "Asia/Shanghai")
    @TableField(value = "end_time")
    private Date endTime;

    /**
     * 外键(商品id)
     */
    @TableField(value = "goods_id")
    private Integer goodsId;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    //  1-1关联 代表数据库中没有这个字段
    @TableField(exist = false)
    private Goods goods;
}